function loadPage(selector, url, callback, error) {
    if ( typeof(selector) == 'string' ) {
        selector = $(selector);
    }

    $.ajax({
        url: url,
        type: 'get',
        async: true,
        dataType: 'html',
        success: function(data) {
            $(selector).html(data);

            if ( callback ) {
                callback(data);
            }
        },
        error: function(req, message, e) {
            console.log(message);
            console.log(e);

            alert('加载页面失败');
            if ( error ) {
                error(req, message, e);
            }
        }
    });
}
